package com.faithbj.printer.util;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

/**
 * 资源url及参数配置
 * @author yangtongjiang
 *
 */
public class URLMapping {
	private static Logger logger = Logger.getLogger(URLMapping.class);
	private String xmlPath = "/URLMapping.xml";
	private Map<String,String[]> urlMapping = new HashMap<String,String[]>();
	private static URLMapping instance = new URLMapping();

	private URLMapping(){
//		SAXBuilder saxb = new SAXBuilder();
//		Document xmldoc;
//		try {
//			xmldoc = saxb.build(getClass().getResourceAsStream(xmlPath));
//			@SuppressWarnings("unchecked")
//			List<Element> root = xmldoc.getRootElement().getChildren();
//			for (Iterator<Element> it = root.iterator(); it.hasNext();) {
//				Element e = it.next();
////				urlMapping.put(e.getChildText("id"), new String[]{e.getChildText("name"),e.getChildText("url"),e.getChildText("parsetype"),e.getChildText("relevance")});
//			}
//		} catch (JDOMException e1) {
//			e1.printStackTrace();
//			logger.error("URLMapping.xml解析异常");
//		} catch (IOException e1) {
//			e1.printStackTrace();
//			logger.error("URLMapping.xml读取异常");
//		}

	}

	public static URLMapping getInstance(){
		return instance;
	}
	
	public Map<String,String[]> getUrlMapping(){
		return urlMapping;
	}
}
